public class PrintA implements Runnable {
    private State state;
    public PrintA(State state) {
        this.state = state;
    }
    @Override
    public void run(){
        while(true){
            try{
                synchronized (state){
                    if(state.bRet){
                        state.wait();
                    }
                    System.out.println("aa...");
                    Thread.sleep(1000);
                    state.bRet = true;
                    state.notify();
                }
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}
